﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using RadioThermostat.Common;

namespace RadioThermostat
{
    public class RTSys
    {
        private RTThermostat thermostat;
        private readonly IJSONDecoder JSON = JSONNetDecoderv.Instance;
        private readonly WebCommunicator webCommunicator;

        internal RTSys(RTThermostat thermostat)
        {
            this.thermostat = thermostat;
            this.webCommunicator = thermostat.WebCommunicator;
        }

        public RTSysInfo GetSysInfo()
        {
            string url =RTUtils.GetURL(thermostat, "sys");
            string responce = webCommunicator.HttpGet(url);
            return JSON.Deserialize<RTSysInfo>(responce);
        }

        public RTSysNetwork GetNetworkInfo()
        {
            string url = RTUtils.GetURL(thermostat, "sys/network");
            string responce = webCommunicator.HttpGet(url);
            return JSON.Deserialize<RTSysNetwork>(responce);
        }
    }
}
